package com.bom.boot.core;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "springdoc")
@Data
public class ApiConfig {
    private Info info;
    private License license;
    private ExternalDocumentation externalDocumentation;

    @Bean
    public OpenAPI openapi() {
        return new OpenAPI()
                .info(info.license(license))
                .externalDocs(externalDocumentation);
    }
}
